package com.example.test10mvc.controller;

import com.example.test10mvc.utils.RestResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.RequestScope;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @Author: fxy
 * @Date: 2022/01/25/17:31
 * @Description:
 */
@RequestMapping("/demo")
@RestController
public class DemoController {
    @Resource
    public HttpServletRequest request;

    @GetMapping("/t1")
    public RestResult<Object> t1() throws InterruptedException {
        request.setAttribute("name","d1t1");
        System.out.println(request.getAttribute("name"));
        Thread.sleep(6000);
        System.out.println("111");
        return null;
    }

    @GetMapping("/t2")
    public RestResult<Object> t2(){
        request.setAttribute("name","d1t2");
        System.out.println(request.getAttribute("name"));
        return null;
    }
}
